(defun c:acris-line (/ *error* pts-stack last-point next-point)
  (defun *error* (msg)
    ()
  )
  (setq pts-stack '())
  (setq last-point (getvar "LASTPOINT"))
  (while t
    (if	(= (length pts-stack) 0)
      (progn
	(setvar	'LASTPOINT
		(car (setq pts-stack
			    (append (list (getpoint "Specify first point: "))
				    pts-stack
			    )
		     )
		)
	)
	(terpri)
      )
      (progn
	(if (>= (length pts-stack) 3)
	  (progn
	    (initget "Undo Close")
	    (setq next-point
		   (getpoint (car pts-stack)
			     "Specify next point or [Close/Undo]: "
		   )
	    )
	  )
	  (progn
	    (initget "Undo")
	    (setq next-point
		   (getpoint (car pts-stack)
			     "Specify next point or [Undo]: "
		   )
	    )
	  )
	)
	(terpri)
	(cond
	  (
	   (listp next-point)		; point
	   (progn
	     (setvar
	       'LASTPOINT
	       (car
		 (setq
		   pts-stack (append (list next-point) pts-stack)
		 )
	       )
	     )
	     (entmake
	       (list
		 (cons '0 "LINE")
		 (cons '11 (car pts-stack))
		 (cons '10 (cadr pts-stack))
	       )
	     )
	   )
	  )
	  (
	   (= next-point "Close")	; close
	   (progn
	     (entmake
	       (list
		 (cons '0 "LINE")
		 (cons '10 (car pts-stack))
		 (cons '11 (last pts-stack))
	       )
	     )
	     (setvar 'LASTPOINT (last pts-stack))
	     (exit)
	   )
	  )
	  (
	   (= next-point "Undo")	; undo
	   (progn
	     (if (> (length pts-stack) 1)
	       (entdel (entlast))
	     )
	     (setq pts-stack (cdr pts-stack))
	     (if (zerop (length pts-stack))
	       (setvar 'LASTPOINT last-point)
	       (setvar 'LASTPOINT (car pts-stack))
	     )
	   )
	  )
	  (t nil)
	)
      )
    )
  )
)